$wgLastDatabaseQuery = "";
+/* private */ $wgBufferSQLResults = true;
+
function wfGetDB( $altuser = "", $altpassword = "", $altserver = "", $altdb = "" )
{
global $wgDBserver, $wgDBuser, $wgDBpassword;
# Replication is not actually implemented just yet
function wfQuery( $sql, $db, $fname = "" )
{
- global $wgLastDatabaseQuery, $wgOut, $wgDebugDumpSql;
+ global $wgLastDatabaseQuery, $wgOut, $wgDebugDumpSql, $wgBufferSQLResults;
global $wgProfiling;
-
if ( $wgProfiling ) {
# wfGeneralizeSQL will probably cut down the query to reasonable
# logging size most of the time. The substr is really just a sanity check.
}
$conn = wfGetDB();
- $ret = mysql_query( $sql, $conn );
+ if( $wgBufferSQLResults ) {
+ $ret = mysql_query( $sql, $conn );
+ } else {
+ $ret = mysql_unbuffered_query( $sql, $conn );
+ }
if ( false === $ret ) {
$wgOut->databaseError( $fname );
return $ret;
}
+function wfUnbufferedQuery( $sql, $db, $fname = "" ){
+ global $wgBufferSQLResults;
+ $oldstate = $wgBufferSQLResults;
+
+ $wgBufferSQLResults = true;
+ $res = wfQuery($sql, $db, $fname);
+
+ $wgBufferSQLResults = $oldstate;
+ return $res;
+}
+
function wfFreeResult( $res ) { mysql_free_result( $res ); }
function wfFetchObject( $res ) { return mysql_fetch_object( $res ); }
function wfNumRows( $res ) { return mysql_num_rows( $res ); }